'use strict';

module.exports = app => {
  const mongoose = app.mongoose;
  const Schema = mongoose.Schema;
  // 下面得操作是连接数据库
  const EventsSchema = new Schema({
    // 修改和新增用到，规定字段得类型和其他条件等
    events: {
      type: Object,
    },
    id: {
      type: Number,
    },
    // title: {
    //   type: String,
    //   required: true,
    // },
    // _id: {
    //   type: Schema.ObjectId,
    //   ref: 'Tags',
    //   required: true,
    // },
    // summary: {
    //   type: String,
    // },
  }, { versionKey: false });
  // return mongoose.model('Event', EventsSchema, 'events');
  return mongoose.model('Event', EventsSchema);
};
